package com.lanou.dao.impl;

import com.lanou.bean.ShowImg;
import com.lanou.dao.ShowImgDao;
import com.lanou.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class ShowImgDaoImpl implements ShowImgDao {

    private Connection connection;
    private PreparedStatement pstm;
    private ResultSet rs;

    @Override
    public void insertInfo(ShowImg showImg) throws Exception {
        String sql = "INSERT INTO showimg (src, goodId) VALUES (?,?)";

        connection = JDBCUtils.getConnection();
        pstm = connection.prepareStatement(sql);

        pstm.setString(1,showImg.getSrc());
        pstm.setInt(2,showImg.getGoodid());

        pstm.executeUpdate();

        JDBCUtils.close(pstm,connection);
    }
}
